#pragma once
#include "Colider.h"
#include "BoundingBox.h"

class OctTree;

struct OctChild;

class QuadTreeNode
{
private:
	std::vector<OctChild*> _objects;
	BoundingBox _box;
	QuadTreeNode* _parent;
	QuadTreeNode* _children[8];
	OctTree* _tree;
	int Depth;
public:
	QuadTreeNode(QuadTreeNode* parent, BoundingBox bBox, OctTree* tree);
	~QuadTreeNode(void);
	// makes the children nodes when they are needed
	void MakeNodes();
	// adds an object to the tree at its lowest point
	QuadTreeNode* AddObject(OctChild* obj);
	// tells how many objects are contned in this node and its children
	int Contains();

	void RemoveObject(OctChild* obj);

	void Orginize();
	bool MoveUp(OctChild* obj);
	bool MoveDown(OctChild* obj);

	void Draw();

	std::vector<Colider*> InBox();
};

struct OctChild {

	Colider* _gameObject;

	QuadTreeNode* _location;
};

#include "OctTree.h"



